//
//  KDDRegistration.m
//  MengLiao
//
//  Created by xiuxin on 2022/7/15.
//  Copyright © 2022 HZMengLiao. All rights reserved.
//

#import "KDDConfig.h"
#import "KDDModel.h"

@interface KDDConfig()

@property (strong,nonatomic) NSMutableDictionary<NSNumber *,KDDEventHandler> * eventHandlerInfo;

@end

@implementation KDDConfig
KNSCopyingImpl

- (instancetype)init
{
    if (self = [super init])
    {
        self.eventHandlerInfo = [NSMutableDictionary dictionary];
        self.registerInfo = [NSMutableDictionary dictionary];
    }
    return self;
}

- (void)setHandler:(KDDEventHandler)handler forEvent:(KDDEventType)event
{
    self.eventHandlerInfo[@(event)] = [handler copy];
}

- (KDDEventHandler)handlerForEvent:(KDDEventType)event
{
    return self.eventHandlerInfo[@(event)];
}

- (void)configModel:(NSObject *)model
{
    if (self.reuseIDBlock != nil)
    {
        model.ddReuseID = self.reuseIDBlock(model,model.ddViewType);
    }
    else if (self.reuseID.length > 0)
    {
        model.ddReuseID = self.reuseID;
    }
    if (self.sizeBlock != nil)
    {
        model.ddSize = self.sizeBlock(model,nil);
    }
    else if (self.itemSize != nil)
    {
        model.ddSize = self.itemSize;
    }
}

@end


////iOS11生效
//@property (nonatomic) BOOL performsFirstActionWithFullSwipe;

//@property (strong,nonatomic) NSDictionary<NSString *,UITableViewRowAction *> * rowActionInfo;//todo

////- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath;
////- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section;
////- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section;
////height
//@property (copy,nonatomic) KDDValueBlock heightBlock;
//@property (strong,nonatomic) NSNumber * defaultHeight;

////- (NSInteger)tableView:(UITableView *)tableView indentationLevelForRowAtIndexPath:(NSIndexPath *)indexPath;
//@property (copy,nonatomic) KDDValueBlock indentBlock;
//
////- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath
////- (NSArray<UIDragItem *> *)collectionView:(UICollectionView *)collectionView itemsForBeginningDragSession:(id<UIDragSession>)session atIndexPath:(NSIndexPath *)indexPath;
////- (NSArray<UIDragItem *> *)collectionView:(UICollectionView *)collectionView itemsForAddingToDragSession:(id<UIDragSession>)session atIndexPath:(NSIndexPath *)indexPath point:(CGPoint)point
//@property (copy,nonatomic) KDDValueBlock canMoveBlock;
//
////- (nullable UISwipeActionsConfiguration *)tableView:(UITableView *)tableView leadingSwipeActionsConfigurationForRowAtIndexPath:(NSIndexPath *)indexPath API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(tvos);
//@property (copy,nonatomic) KDDValueBlock leadingActionIDListBlock;
////- (nullable NSArray<UITableViewRowAction *> *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath NS_AVAILABLE_IOS(8_0) __TVOS_PROHIBITED;
////- (nullable UISwipeActionsConfiguration *)tableView:(UITableView *)tableView trailingSwipeActionsConfigurationForRowAtIndexPath:(NSIndexPath *)indexPath API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(tvos);
//@property (copy,nonatomic) KDDValueBlock trailingActionIDListBlock;


//- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath;
//- (void)tableView:(UITableView *)tableView willDisplayHeaderView:(UIView *)view forSection:(NSInteger)section NS_AVAILABLE_IOS(6_0);
//- (void)tableView:(UITableView *)tableView willDisplayFooterView:(UIView *)view forSection:(NSInteger)section NS_AVAILABLE_IOS(6_0);

//- (void)tableView:(UITableView *)tableView didEndDisplayingCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath*)indexPath NS_AVAILABLE_IOS(6_0);
//- (void)tableView:(UITableView *)tableView didEndDisplayingHeaderView:(UIView *)view forSection:(NSInteger)section NS_AVAILABLE_IOS(6_0);
//- (void)tableView:(UITableView *)tableView didEndDisplayingFooterView:(UIView *)view forSection:(NSInteger)section NS_AVAILABLE_IOS(6_0);
